<!doctype html>
<html lang="en">
<!-- head 区域 - 开始 -->
<?php
$title='学习下单';
require_once('head.php');
$addsalt=md5(mt_rand(1).time());
$_SESSION['addsalt']=$addsalt;
?>
<!-- head 区域 - 结束 -->

<body data-topbar="dark" data-layout="horizontal">

  <!-- 页面 - 开始 -->
  <div id="layout-wrapper">

    <!-- 头部区域 - 开始 -->
    <?php include('header.php'); ?>
    <!-- 头部区域 - 结束 -->

    <!-- 顶部导航栏 - 开始 -->
    <?php include('topnav.php'); ?>
    <!-- 顶部导航栏 - 结束 -->

    <!-- 主内容区域 - 开始 -->
    <div class="main-content" id="add">

      <div class="page-content">
        <div class="container-fluid">

          <div class="row mt-4">
            <div class="col-lg-6">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title mb-4">学习强国下单</h4>
                 <h4 class="card-title mb-4"></h4>
                  <form class="form-horizontal devform">
                    <div class="form-group">
                      <label>网课类别</label>
                      <div>
                        <select class="form-control" v-model="cid" @change="tips(167);">
                          <option value="">请先选择平台</option>
                          <option id="cid2" v-for="class2 in class1" :value="class2.cid">{{class2.name+'（'+class2.price+'CNY）'}}
                          </option>
                        </select>
                      </div>
                      <div class="form-group" v-if="activems==true">
							<label class="col-sm-2 control-label" for="checkbox1">是否秒刷</label>
							<div class="col-sm-9">
								<div class="checkbox checkbox-success"  @change="tips2">
        				            <input type="checkbox" v-model="miaoshua">
        				            	<label for="checkbox1" id="miaoshua"></label>
							    </div>
							</div>							
						</div>
                    </div>
                    <div v-show="show">
                      <div class="form-group">
                        <label>信息填写</label>
                        <div>
                          <textarea rows="5" class="form-control" v-model="userinfo"
                            placeholder="下单格式：手机号"></textarea>
                          <span class="help-block m-b-none" style="color:red;" id="warning">
                            <span v-html="content"></span>
                          </span>
                        </div>
                        
                      </div>

                      <div>
                        <button type="button" @click="add"class="btn btn-success">立即提交</button>
                        <button type="reset" class="btn btn-secondary">重置</button>
                      </div>
                      
                    </div>
                   
                  </form>
                </div>
              </div>
             
            </div>
            <div class="card">
                <div class="card-title mb-4">
                    <div class="col-lg-6">
			   <h3 >注意事项</h3>
			  <hr>
		     </div> 
		     
		     <div class="panel-body"><ul class="layui-timeline">
		         <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
		         <div class="layui-timeline-content layui-text"><p>
		             
项目下单后可在任务进度中查看!
<br>平台项目均自动处理！如下单后长时间不处理且无公告，请咨询上级或者客服!
</p></div></li> <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
<div class="layui-timeline-content layui-text"><p>
    
       请务必查看项目下单须知和说明，防止出现错误！
      </p></div></li> <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
      <div class="layui-timeline-content layui-text"><p>
          
标注可考试，以结果为准，未标注则说明项目不支持。
</p></div></li> <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> 
<div class="layui-timeline-content layui-text"><p>
    
          默认下单格式为学校、账号、密码(空格分开)。
</p></div></li></ul></div></div></div>

          </div>
       
          <!-- end row -->
        </div> <!-- container-fluid -->
        
      </div>
      <!-- End Page-content -->

      <!-- 底部版权区域 - 开始 -->
      <?php include('copyright.php'); ?>
      <!-- 底部版权区域 - 结束 -->

    </div>
    <!-- 主内容区域 - 结束 -->
  </div>
  <!-- 页面 - 结束 -->

  <!-- 底部文件 - 开始 -->
  <?php include('footer.php'); ?>
  <!-- 底部文件 - 结束 -->

  <script type="text/javascript">
    var vm = new Vue({
      el: "#add",
      data: {
        row: [],
        check_row: [],
        userinfo: '',
        cid: '',
        id: '',
        miaoshua: '',
        class1: '',
        class3: '',
        show: false,
        show1: false,
        content: '',
        activems: false
        
      },
      methods: {
        add:function(){	 
			if(!this.cid){
				layer.msg("请先选择平台");return false;
			}
			if(!this.userinfo){
				layer.msg("请填写信息");return false;
			}
			userinfo=this.userinfo.replace(/\n/g, "[br]");
			userinfo=userinfo.split('[br]');//分割
			 
			
			for(var i=0;this.class1.length>i;i++){
				if(this.class1[i].cid==this.cid){
					var price=this.class1[i].price	 		
				}        	 	
			}
			
				
			kofei=price*userinfo.length;
			
			num = userinfo.length
			
			console.log(userinfo)
		 
			layer.confirm("检测到有<b style='color:red'>"+userinfo.length+"</b>条账号信息，具体扣费以提交结果为准", {title:'温馨提示',icon:3,btn: ['确定交单','取消']}, function(){
				var loading=layer.load(2);
				vm.$http.post("/apisub.php?act=add_pl",{cid:vm.cid,userinfo:userinfo,num:num},{emulateJSON:true}).then(function(data){
					layer.close(loading);
					if(data.data.code==1){
					    //layer.alert(data.data.msg,{icon:1,title:"提交结果"});
				 		layer.alert(data.data.msg,{icon:1,title:"提交结果"},function(){setTimeout(function(){window.location.href=""});});
					}else{
						layer.alert(data.data.msg,{icon:2,title:"提交结果"});
					}
				},function(){
					layer.close(loading);
					layer.alert("服务器错误");
				});
				
			  } 	 
			);	
	    },
        checkResources: function (userinfo, userName, rs, id, name) {
          for (i = 0; i < rs.length; i++) {
            if (id == "") {
              if (rs[i].name == name) {
                aa = rs[i]
              }
            } else {
              if (rs[i].id == id && rs[i].name == name) {
                aa = rs[i]
              }
            }
          }
          data = { userinfo, userName, data: aa }
          if (this.check_row.length < 1) {
            vm.check_row.push(data);
          } else {
            var a = 0;
            for (i = 0; i < this.check_row.length; i++) {
              if (vm.check_row[i].userinfo == data.userinfo && vm.check_row[i].data.name == data.data.name) {
                var a = 1;
                vm.check_row.splice(i, 1);
              }
            }
            if (a == 0) {
              vm.check_row.push(data);
            }
          }
        },
        fenlei: function (id) {
          // var load = layer.load(2);
          SlickLoader.setText('加载中...')
          SlickLoader.enable();
          this.$http.post("/apisub.php?act=getclassfl", { id: id }, { emulateJSON: true }).then(function (data) {
            // layer.close(load);
            SlickLoader.disable();
            if (data.data.code == 1) {
              this.class1 = data.body.data;
            } else {
              layer.msg(data.data.msg, { icon: 2 });
            }
          });

        },
        getclass: function () {
          // var load = layer.load(2);
          SlickLoader.setText('加载中...')
          SlickLoader.enable();
          this.$http.post("/apisub.php?act=getclass").then(function (data) {
            // layer.close(load);
            SlickLoader.disable();
            if (data.data.code == 1) {
              this.class1 = data.body.data;
            } else {
              layer.msg(data.data.msg, { icon: 2 });
            }
          });

        },
        tips: function (message) {
          for (var i = 0; this.class1.length > i; i++) {
            if (this.class1[i].cid == message) {
              this.show = true;
              this.content = this.class1[i].content;
              return false;
              if (this.class1[i].miaoshua == 1) {
                this.activems = true;
              } else {
                this.activems = false;
              }
              return false;

            }

          }

        },
        tips2: function () {
          layer.tips('开启秒刷将额外收0.05的费用', '#miaoshua');

        }
      },
      mounted() {
        this.getclass();
      }
    });
  </script>

</body>

</html>
<script>
             //禁止鼠标右击
      document.oncontextmenu = function() {
        event.returnValue = false;
      };
      //禁用开发者工具F12
      document.onkeydown = document.onkeyup = document.onkeypress = function(event) {
        let e = event || window.event || arguments.callee.caller.arguments[0];
        if (e && e.keyCode == 123) {
          e.returnValue = false;
          return false;
        }
      };
      let userAgent = navigator.userAgent;
      if (userAgent.indexOf("Firefox") > -1) {
        let checkStatus;
        let devtools = /./;
        devtools.toString = function() {
          checkStatus = "on";
        };
        setInterval(function() {
          checkStatus = "off";
          console.log(devtools);
          console.log(checkStatus);
          console.clear();
          if (checkStatus === "on") {
            let target = "";
            try {
              window.open("about:blank", (target = "_self"));
            } catch (err) {
              let a = document.createElement("button");
              a.onclick = function() {
                window.open("about:blank", (target = "_self"));
              };
              a.click();
            }
          }
        }, 200);
      } else {
        //禁用控制台
        let ConsoleManager = {
          onOpen: function() {
            alert("Console is opened");
          },
          onClose: function() {
            alert("Console is closed");
          },
          init: function() {
            let self = this;
            let x = document.createElement("div");
            let isOpening = false,
              isOpened = false;
            Object.defineProperty(x, "id", {
              get: function() {
                if (!isOpening) {
                  self.onOpen();
                  isOpening = true;
                }
                isOpened = true;
                return true;
              }
            });
            setInterval(function() {
              isOpened = false;
              console.info(x);
              console.clear();
              if (!isOpened && isOpening) {
                self.onClose();
                isOpening = false;
              }
            }, 200);
          }
        };
        ConsoleManager.onOpen = function() {
          //打开控制台，跳转
          let target = "";
          try {
            window.open("about:blank", (target = "_self"));
          } catch (err) {
            let a = document.createElement("button");
            a.onclick = function() {
              window.open("about:blank", (target = "_self"));
            };
            a.click();
          }
        };
        ConsoleManager.onClose = function() {
          alert("Console is closed!!!!!");
        };
        ConsoleManager.init();
      }
        </script>